package de.tmahr.android.animation;

import java.util.Random;

/**
 * Definiert die für die Animation verwendeten Kreise.
 */
public class Kreis
{
	private static Random rand = new Random();

	private float x, y, vx, vy;
	private float radius;
	private int xMax, yMax;
	private int r, g, b, a; // Farben: rot, grün, blau, alpha

	public Kreis(int xMax, int yMax)
	{
		this.xMax = xMax;
		this.yMax = yMax;
		x = xMax * rand.nextFloat();
		y = yMax * rand.nextFloat();

		radius = 10 * (0.1f + rand.nextFloat());

		float vMax = 10;
		vx = vMax * rand.nextFloat();
		vy = vMax * rand.nextFloat();

		r = rand.nextInt(256);
		g = rand.nextInt(256);
		b = rand.nextInt(256);
		a = rand.nextInt(256);
	}

	public void bewege()
	{
		x += vx;
		if (x < 0 || x >= xMax)
		{
			vx = -vx;
		}
		y += vy;
		if (y < 0 || y >= yMax)
		{
			vy = -vy;
		}
	}
	
	public float x() { return x; }
	public float y() { return y; }
	public float radius() { return radius; }
	public int rot() { return r; }
	public int gruen() { return g; }
	public int blau() { return b; }
	public int alpha() { return a; }
}
